/**
 * Created by bgy on 2016/12/6.
 * 我的水果
 */
import React from 'react';
import {Link} from 'react-router';

class GoodsApplyQualityComponent extends React.Component {

  constructor() {
    super();
    this.state = {
      showMain:true,
      showSelCate:false,
      //测试数据
      qualityRecordList: [],
      txt:''
      }
    }

  componentWillReceiveProps() {
    console.info(this.props);
    //获取质检申请记录列表
    if (this.props['data-vendorGoodsId']) {
      console.info(this.props['data-vendorGoodsId']);
      //$.ajax(
      //  {
      //    'url': this.props.config.baseUrl + '/quality/queryQualityRecordList',
      //    type: 'post',
      //    dataType: 'JSON',
      //    data: JSON.stringify({
      //      vendorGoodsId: this.props['data-vendorGoodsId'],
      //      vendorId: window.localStorage.getItem('vendorInfo').vendorId
      //    }),
      //    success: function (data) {
      //      if (data.errorCode == 0) {
      //        this.setState({qualityRecordList: data.data});
      //      }
      //    }.bind(this),
      //    error: function (data) {
      //      return data;
      //    }
      //  }
      //);
    }
  }

  change() {
    var keyWord = this.refs.txt.value.replace(/\s+/g,'');
    if (keyWord) {

    } else {

    }
  }

  SelCate(){
    this.props.changeTitle('选择水果');
    this.setState({
      showMain:false,
      showSelCate:true
    });
  }
  SelAddr(){

  }
  render() {

    return (
    <article>
      <section className={this.state.showMain?'quality-box':'quality-box sink'}>
        <form onSubmit={this.handleSubmit}>
          <div className='edit-form'>
            <div className='edit-item'>
              <label>
                <span className="label-lt">水果名称</span>
                <span className="label-rt">
                  <select className='input-item' onClick={this.SelCate.bind(this)}>
                    <option value="">请选择</option>
                  </select>
                </span>
              </label>
            </div>
            <div className='edit-item'>
              <label>
                <span className="label-lt">地域</span>
                <span className="label-rt">
                  <select className='input-item' onClick={this.SelAddr.bind(this)}>
                    <option value="">请选择</option>
                  </select>
                </span>
              </label>
            </div>
          </div>
          <input type="submit" value="Submit"/>
        </form>
      </section>
      <section className={this.state.showSelCate?'quality-box':'quality-box sink'}>
          <div className='cate-box'>
            <input type='text' ref='txt' onInput={this.change.bind(this)} className='input-item' placeholder='请输入水果关键词'/>
          </div>
      </section>
      <section className={this.state.showAddr?'':''}></section>
    </article>

    )
  }

}

export default GoodsApplyQualityComponent;

